<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"  xmlns:sec="http://www.thymeleaf.org/extras/spring-security">

<div id="page-content">
    <div class="row" id="targetEvaluate-btn-row">
        <div class="col-sm-6 table-toolbar-left">
            <button type="button" class="btn btn-primary btn-sm" id="btn-targetEvaluate-add" th:disabled="${!isCreator}">新建指标评测</button>
        </div>
    </div>

    <div class="jqGrid_wrapper">
        <table id="targetEvaluate_table"></table>
        <div id="targetEvaluate_page"></div>
    </div>
</div>

<script th:inline="javascript">

    $(function(){
        init_grid_targetEvaluateDict();
        setTimeout(function(){
            __jqGrid_width("targetEvaluate_table", $("#targetEvaluate-btn-row").width())
        }, 300);
    });

    function init_grid_targetEvaluateDict(){
        __init_jqgrid('targetEvaluate_table', 'targetEvaluate_page', ctx + 'targetEvaluate/list?targetId='+[[${parentId}]],
            ["指标名称","评测人","评测时间","操作","id"],
            [
                {name: 'target.name', index: 'target.name', width: 100, sortable: false, searchoptions: {sopt: ['cn']}},
                {name: 'creator.name', index: 'creator.name', width: 100, sortable: false, searchoptions: {sopt: ['cn']}},
                {name: 'createTime', index: 'createTime', width: 100, sortable: false, searchoptions: {sopt: ['cn']}},
                {name: 'act', index: 'act', width: 150, sortable: false, search: false, formatter: actFormat_targetEvaluate},
                {name: 'id', index: 'id', width: 100, key: true, hidden: true}
            ]
        );
    }

    function actFormat_targetEvaluate(cellvalue, options, rowObject){
        var id = rowObject.id;
        cellvalue = '<button class="btn btn-default btn-xs" onclick="fn_targetEvaluate_read(\'' + id + '\');">查看</button> ';
        return cellvalue;
    }

    //input
    $("#btn-targetEvaluate-add").on("click", function(){
        __layX_html_read("create", "指标评测", ctx + "targetEvaluate/input?parentId="+[[${parentId}]], {width : "60%", height : "60%"});
    });

    //read
    function fn_targetEvaluate_read(id){
        __layX_html_read(id, "指标评测", ctx + "targetEvaluate/read?keyId="+id, {width : "60%", height : "60%"});
    }

    //更新
    function fn_targetEvaluate_update(id){
        __layX_html_read(id, "指标评测", "/targetEvaluate/input?editType=update&keyId="+id);
    }

</script>

</html>